home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / finalize.h < prev    next >
C/C++ Source or Header  |  1998-09-15  |  2KB  |  68 lines

  1. /*
  2.  * @(#)finalize.h    1.20 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. #ifndef _FINALIZE_H_
  16. #define _FINALIZE_H_
  17.  
  18. #include "oobj.h"
  19. #include "sys_api.h"
  20.  
  21. /*
  22.  * The HasFinalizerQ and FinalizeMeQ queues contain finalizer_t
  23.  * structures.  Handles rather than objects are used to avoid relocating
  24.  * the contents of the queues on GC.
  25.  */
  26. typedef struct {
  27.     JHandle *next;              /* The next finalizer object */
  28. } finalizer_t;
  29.  
  30. extern JHandle *HasFinalizerQ;
  31. extern JHandle *FinalizeMeQ;
  32. extern JHandle *FinalizeMeQLast;
  33. extern JHandle *BeingFinalized;
  34.  
  35. extern bool_t finalize_on_exit;
  36.  
  37. #define FINALIZER_T(h) \
  38.         ((finalizer_t *)((char *)h->obj + cbInstanceSize(obj_classblock(h))))
  39.  
  40. /*
  41.  * Locks for the finalization queues
  42.  */
  43. extern sys_mon_t *_hasfinalq_lock;
  44. #define HASFINALQ_LOCK_INIT()    monitorRegister(_hasfinalq_lock, \
  45.                         "Has finalization queue lock")
  46. #define HASFINALQ_LOCK()    sysMonitorEnter(_hasfinalq_lock)
  47. #define HASFINALQ_LOCKED()    sysMonitorEntered(_hasfinalq_lock)
  48. #define HASFINALQ_UNLOCK()    sysMonitorExit(_hasfinalq_lock)
  49. #define HASFINALQ_NOTIFY()    sysMonitorNotify(_hasfinalq_lock)
  50.  
  51. extern sys_mon_t *_finalmeq_lock;
  52. #define FINALMEQ_LOCK_INIT()    monitorRegister(_finalmeq_lock, \
  53.                         "Finalize me queue lock")
  54. #define FINALMEQ_LOCK()        sysMonitorEnter(_finalmeq_lock)
  55. #define FINALMEQ_LOCKED()    sysMonitorEntered(_finalmeq_lock)
  56. #define FINALMEQ_UNLOCK()    sysMonitorExit(_finalmeq_lock)
  57. #define FINALMEQ_NOTIFY()    sysMonitorNotify(_finalmeq_lock)
  58. #define FINALMEQ_WAIT()        sysMonitorWait(_finalmeq_lock, \
  59.                            SYS_TIMEOUT_INFINITY, FALSE)
  60.  
  61. extern void InitializeFinalizer(void);
  62. extern void InitializeFinalizerThread(void);
  63.  
  64. extern void runFinalization(void);
  65. extern void finalizeOnExit(void);
  66.  
  67. #endif /* _FINALIZE_H_ */
  68.